package com.hb.trans.mvp.ui.adapter

import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hb.trans.R
import com.hb.trans.bean.School
import javax.inject.Inject

class SchoolAdapter(layoutResId: Int) : BaseQuickAdapter<School, BaseViewHolder>(layoutResId) {
    @Inject
    constructor() : this(R.layout.item_school)

    override fun convert(helper: BaseViewHolder, item: School) {
        item.apply {
            helper.setText(R.id.tvSchoolName, shortname)
                .setText(R.id.tvSchoolAddress, address)
            if (busistatus == 1) {
                helper.setText(R.id.tvSchoolStatus, "营业")
                    .setTextColor(R.id.tvSchoolStatus, ContextCompat.getColor(mContext, R.color.blue_23))
            } else {
                helper.setText(R.id.tvSchoolStatus, "停止招生")
                    .setTextColor(R.id.tvSchoolStatus, ContextCompat.getColor(mContext, R.color.red_d0))
            }
        }
    }

}
